#include <cstdio>
#include <cmath>

double ax, ay, bx, by, cx, cy, dx, dy, p, q, r;

double distance( double x1, double y1, double x2, double y2 )
{
    return sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );
}

double calcB( double pp1 )
{
    double left = 0, right = 1, mid1, mid2, ac1, ac2, xx1, yy1, xx2, yy2, dp, dq, dr;
    xx1 = ( bx - ax ) * pp1 + ax;
    yy1 = ( by - ay ) * pp1 + ay;
    while ( 1 )
    {
        mid1 = left + ( right - left ) / 3;
        mid2 = left + ( right - left ) / 3 * 2;
        xx2 = ( cx - dx ) * mid1 + dx;
        yy2 = ( cy - dy ) * mid1 + dy;
        ac1 = distance( cx, cy, dx, dy ) * mid1 / q + distance( xx1, yy1, xx2, yy2 ) / r;
        xx2 = ( cx - dx ) * mid2 + dx;
        yy2 = ( cy - dy ) * mid2 + dy;
        ac2 = distance( cx, cy, dx, dy ) * mid2 / q + distance( xx1, yy1, xx2, yy2 ) / r;
        if ( mid2 - mid1 < 1e-6 )
            return ac1;
        if ( ac1 > ac2 )
            left = mid1;
        else
            right = mid2;
    }
}

void calcA( )
{
    double left = 0, right = 1, mid1, mid2, ac1, ac2;
    while ( 1 )
    {
        mid1 = left + ( right - left ) / 3;
        mid2 = left + ( right - left ) / 3 * 2;
        ac1 = calcB( mid1 ) + distance( ax, ay, bx, by ) * mid1 / p;
        ac2 = calcB( mid2 ) + distance( ax, ay, bx, by ) * mid2 / p;
        if ( mid2 - mid1 < 1e-6 )
            break;
        if ( ac1 > ac2 )
            left = mid1;
        else
            right = mid2;
    }
    printf("%.2lf\n", ac1);
}

int main( )
{
    int t;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &cx, &cy, &dx, &dy, &p, &q, &r);
        calcA( );
    }
    return 0;
}
